package com.ljt.controller;

import com.ljt.entity.UserEntity;
import com.ljt.service.UserService;
import com.ljt.utils.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping(value = "/login")
public class LoginController {
    @Autowired
    private UserService userService;
    @RequestMapping(method = RequestMethod.GET)
    public String login(){
        return "login";
    }
    @ResponseBody
    @RequestMapping(method = RequestMethod.POST)
    public ResponseData login(UserEntity userEntity){
        try {
            userService.login(userEntity);
            System.out.println(userEntity.toString());
        } catch (Exception e) {
//            return ResponseData.error(e.getMessage());
        }
        return ResponseData.success();
    }
}
